
<?php 
header("Content-type: text/html; charset=utf-8");
// 判断是否post
if($_GET){
	$db = include './db.php';
	foreach ($db as $key => $value) {
		// var_dump($db[$key]);
		if($key==$_GET['id']){
			unset($db[$key]);
		}
		// return $db;不用返回数据
	}
	$newDb = var_export($db,TRUE);
	$newDb2 ="<?php  return $newDb ?>";
	file_put_contents('./db.php',$newDb2);

	$message = "删除成功";

	include './tpl/success.html';

}else{
	// 非POST,跳转回首页
	// 引入错误页面
	$error = "删除失败";
 	include './tpl/error.html';
}


 ?>

